<div class="page-header">
	<ul id="table-tab" class="nav nav-tabs" role="tablist">
		<li role="presentation" class="active">
			<a href="#subjectCount-tab" aria-controls="subjectCount-tab" role="tab" data-toggle="tab">专题统计</a>
		</li>
	</ul>
</div>
<div class="tab-content">
	<div id="subjectCount-tab" class="tab-pane active" role="tabpanel">
		<div class="row">
			<!--搜索域-->
			<div class="col-xs-12">
				<div class="search-area">
					<form id="table-subjectCount-search" class="form-inline">
						<div class="form-group">
							<label for="subName">专题名称：</label>
							<input type="text" class="form-control input-sm" id="subName" name="sub_name" value="" placeholder="按名称搜索">
							<label>统计期限：</label>
							<div class="input-group input-group-sm">
								<input type="text" id="dataBegin" name="dataBegin" class="form-control" placeholder="开始时间" />
								<span class="input-group-addon" style="cursor: pointer;" id="dataBeginImg">
									<i class="ace-icon fa fa-calendar"></i>
								</span>
							</div>
							<label>至</label>
							<div class="input-group input-group-sm">
								<input type="text" id="dataEnd" name="dataEnd" class="form-control" placeholder="结束时间" />
								<span class="input-group-addon" style="cursor: pointer;" id="dataEndImg">
									<i class="ace-icon fa fa-calendar"></i>
								</span>
							</div>
						</div>
						<button id="btn-subjectCount-search" type="button" class="btn btn-info btn-sm no-border">
							<i class="ace-icon fa fa-search bigger-110"></i>查询
						</button>
						<div class="form-group pull-right">
							<span>查询方式：</span>
							<label class="radio-inline">
								<input type="radio" name="searchType" value="1" checked="checked" />精确
							</label>
							<label class="radio-inline">
								<input type="radio" name="searchType" value="0" />模糊
							</label>
						</div>
					</form>
				</div>
			</div>
		</div>
		<!-- 数据表格 -->
		<div class="row">
			<div class="col-xs-12">
				<div id="table-subjectCount-toolbar">
					<div class="btn-group btn-group-sm">
						<!-- <button id="delTemplate" class="btn btn-danger btn-sm no-border" onclick="goDel('删除专题统计数据','mnui/sub/count/goDel');" title="按照某时间段删除数据">
							<i class="ace-icon fa fa-trash-o bigger-110"></i>按照日期范围删除数据
						</button> -->
					</div>
				</div>
				<table id="table-subjectCount" data-toolbar="#table-subjectCount-toolbar" data-sort-name="uuid" data-sort-order="asc" data-show-columns="true" data-id-field="uuid">
					<thead>
						<tr>
							<th data-width="50" data-align="center" data-formatter="creNum">序号</th>
							<th data-field="sub_name" data-align="left" data-sortable="false">专题名称</th>
							<th data-width="200" data-field="sub_create_time" data-align="center" data-sortable="false">专题上线时间</th>
							<th data-width="200" data-field="beginTime" data-align="center" data-sortable="false">统计开始时间</th>
							<th data-width="200" data-field="endTime" data-align="center" data-sortable="false">统计结束时间</th>
							<th data-width="80" data-field="count" data-align="center" data-sortable="false">访问次数</th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">

	$(function() {
		initTableList('table-subjectCount', 'mnui/sub/count/getCountAll','table-subjectCount-search', 'btn-subjectCount-search');
	});
	
	//序号
	function creNum(value,row, index){
		return index+1;
	}
	
	//通过时间段进行删除
	function goDel(title, url) {
		loadModal(url, function(data, status) {
			if (status === "success") {
				changeModalTitle(title);
				showModal();
			} else if (status === "timeout") {
				TipMsg.error("请求超时，请重试!!!", 0);
			}
		});
	}

	//初始化日期控件
	var dataBegin = {
		elem : '#dataBegin',
		format : 'YYYY-MM-DD',
		istime : false,
		istoday : false,
		issure : true,
		choose : function(datas) {
			//需要有日期差，即选择某开始日期后，结束日期应该从开始日期的后一天开始
			var date = new Date(datas);
			var _date = laydate.now(date.getTime() + 86400000, "YYYY-MM-DD");//86400000ms:1day的ms值
			dataEnd.min = _date; //开始日选好后，重置结束日的最小日期
			dataEnd.start = _date //将结束日的初始值设定为开始日
		}
	};
	var dataEnd = {
		elem : '#dataEnd',
		format : 'YYYY-MM-DD',
		istime : false,
		istoday : false,
		issure : true,
		choose : function(datas) {
			//需要有日期差，即选择某结束日期后，开始日期应该从结束日期的前一天开始
			var date = new Date(datas);
			var _date = laydate.now(date.getTime() - 86400000, "YYYY-MM-DD");//86400000ms:1day的ms值
			dataBegin.max = _date; //结束日选好后，重置开始日的最大日期
		}
	};
	//绑定日期控件
	$("#dataBegin").click(function() {
		laydate(dataBegin);
	});
	$("#dataBeginImg").click(function() {
		laydate(dataBegin);
	});
	$("#dataEnd").click(function() {
		laydate(dataEnd);
	});
	$("#dataEndImg").click(function() {
		laydate(dataEnd);
	});
</script>
